<template>
  <div class="setTimeSlots-page">
    <GhNavBar title="预约时段设置" />
    <div class="header">时段设置</div>
    <div class="content-box">
        <van-cell  v-for="item in items " :key="item.id" >
            <div class="box">
                 <div class="timeSlot">
                    <div class="startTime">{{item.start_time}}</div>
                     <div class="icon">-</div>
                    <div class="endTime">{{item.end_time}}</div>
                 </div>
                 <div class="operate">
                    <button class="edit" @click="edit(item)">编辑</button>
                    <button class="del" @click="del(item)">删除</button>
                 </div>
            </div>
        </van-cell>
    </div>
  </div>
</template>

<script setup>
import {ref,reactive,onBeforeMount,computed,onMounted,watch,onBeforeUnmount} from "vue"
import { Toast, Dialog } from 'vant'
import 'vant/es/toast/style'
import{useRouter,useRoute}from 'vue-router'
import {gettimeperiods_admin} from '@/services/admin'
import {useUserStore}from '@/stores'
const route =useRoute()
const router =useRouter();  
const store = useUserStore()
//时间段列表数据响应式变量
const items=ref('')
onMounted(async()=>{
    const res=await gettimeperiods_admin()
    console.log(res.data)
    items.value=res.data
})
//编辑函数
const edit=(item)=>{
    console.log(item)
}
//删除函数
const del=(item)=>{
    console.log(item)
}


</script>

<style lang="scss" scoped>
.setTimeSlots-page{
    width: 100%;
    display: flex;
    flex-direction: column;
    .header{
        margin-top: 44px;
        padding: 0 12px;
        font-size: 18px;
        font-weight: bold;
        font-family: '黑体';
    }
    .content-box{
        margin-top: 10px;
        width: 100%;
        .van-cell{
            margin-top: 6px;
            .box{
                display: flex;
                justify-content: space-between;
                .timeSlot{
                    display: flex;
                    align-items: center;
                    justify-content: space-around;
                    padding: 0 20px;
                    .startTime{
                        border: 1px solid #000;
                        width: 60px;
                        text-align: center;
                        border-radius: 8px;
                    }
                    .icon{
                        margin: 0 10px;
                    }
                    .endTime{
                        width: 60px;
                        border: 1px solid #000;
                        text-align: center;
                        border-radius: 8px;
                    }
                }
                .operate{
                    padding: 0 10px;
                    .edit{
                        margin-right: 15px;
                        border-radius: 8px;
                    }
                    .del{
                        border-radius: 8px;
                        background-color: var(--gh-price);
                        color: #fff;
                    }
                }
            }



        }
    }
}
</style>
